package com.liuyang.controller;


import cn.hutool.core.date.DateUtil;
import cn.hutool.crypto.SecureUtil;
import com.liuyang.common.Result;
import com.liuyang.entity.Account;
import com.liuyang.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 作者:caleb
 * @since 2022-02-22
 */
@RestController
@RequestMapping("/system/account")
public class AccountController {

    @Autowired
    private AccountService accountService;

    /**
     * 编辑个人中心
     * @param account
     * @return
     */
    @PostMapping("/editAccount")
    public Result editAccount(Account account) {
        account.setAccountPassword(SecureUtil.md5(account.getAccountPassword()));
        accountService.saveOrUpdate(account);
        return Result.succ("更新成功...");
    }

}
